import 'package:aidou/pages/login/other.dart';
import 'package:aidou/provider/user.dart';
import 'package:aidou/style/style.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:provider/provider.dart';

/// Describe 登录页
/// Author END
/// DateTime 2022/07/12
class LoginPage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => _LoginStatePage();
}

class _LoginStatePage extends State<LoginPage> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    final data = context.watch<UserProviderModel>();
    return Scaffold(
      appBar: AppBar(
        title: Text('登录'),
      ),
      body: Container(
        padding: EdgeInsets.all(40.w),
        width: double.infinity,
        height: double.infinity,
        color: ColorPlate.back2,
        child: Column(
          children: <Widget>[
            ElevatedButton(
              child: Text('本机号码一键登录'),
              style: ButtonStyle(
                backgroundColor: MaterialStateProperty.all(Colors.red),
                minimumSize: MaterialStateProperty.all(Size(580.w, 80.w)),
              ),
              onPressed: onPressLogin,
            ),
            SizedBox(
              height: 20.h,
            ),
            ElevatedButton(
              child: Text(
                '其他手机号码登录',
                style: TextStyle(color: Colors.black),
              ),
              style: ButtonStyle(
                backgroundColor: MaterialStateProperty.all(Colors.white),
                minimumSize: MaterialStateProperty.all(Size(580.w, 80.w)),
              ),
              onPressed: () {
                Navigator.of(context).push(
                  MaterialPageRoute(builder: (context) {
                    return OtherLoginPage();
                  }),
                );
              },
            ),
            Center(
              child: Text(
                "user: ${context.watch<UserProviderModel>().user.account}",
                style: TextStyle(color: ColorPlate.white),
              ),
            ),
            Center(
              child: Text(
                "user: ${data.user.password}",
                style: TextStyle(color: ColorPlate.white),
              ),
            ),
            Expanded(
              child: Container(),
            ),
            Center(
              child: Text(
                '其他方式登录',
                style: TextStyle(color: ColorPlate.back3),
              ),
            ),
            SizedBox(
              height: 20.h,
            ),
            Center(
              child: Icon(
                Icons.wechat,
                size: 100.w,
                color: Colors.green,
              ),
            )
          ],
        ),
      ),
    );
  }

  void onPressLogin() {}
}
